package com.tms.project.tms.record.service.impl;

import java.util.List;

import com.tms.common.utils.DateUtils;
import com.tms.common.utils.security.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tms.project.tms.record.mapper.TeacherRecordMapper;
import com.tms.project.tms.record.domain.TeacherRecord;
import com.tms.project.tms.record.service.ITeacherRecordService;
import com.tms.common.utils.text.Convert;

/**
 * 教师档案管理Service业务层处理
 *
 * @author xyl
 * @date 2021-03-22
 */
@Service
public class TeacherRecordServiceImpl implements ITeacherRecordService {
    @Autowired
    private TeacherRecordMapper teacherRecordMapper;

    /**
     * 查询教师档案管理
     *
     * @param teacherRecordId 教师档案管理ID
     * @return 教师档案管理
     */
    @Override
    public TeacherRecord selectTeacherRecordById(Long teacherRecordId) {
        return teacherRecordMapper.selectTeacherRecordById(teacherRecordId);
    }

    /**
     * 查询教师档案管理列表
     *
     * @param teacherRecord 教师档案管理
     * @return 教师档案管理
     */
    @Override
    public List<TeacherRecord> selectTeacherRecordList(TeacherRecord teacherRecord) {
        return teacherRecordMapper.selectTeacherRecordList(teacherRecord);
    }

    /**
     * 新增教师档案管理
     *
     * @param teacherRecord 教师档案管理
     * @return 结果
     */
    @Override
    public int insertTeacherRecord(TeacherRecord teacherRecord) {
        teacherRecord.setCreateTime(DateUtils.getNowDate());
        teacherRecord.setCreateBy(ShiroUtils.getLoginName());
        return teacherRecordMapper.insertTeacherRecord(teacherRecord);
    }

    /**
     * 修改教师档案管理
     *
     * @param teacherRecord 教师档案管理
     * @return 结果
     */
    @Override
    public int updateTeacherRecord(TeacherRecord teacherRecord) {
        teacherRecord.setUpdateTime(DateUtils.getNowDate());
        return teacherRecordMapper.updateTeacherRecord(teacherRecord);
    }

    /**
     * 删除教师档案管理对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTeacherRecordByIds(String ids) {
        return teacherRecordMapper.deleteTeacherRecordByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除教师档案管理信息
     *
     * @param teacherRecordId 教师档案管理ID
     * @return 结果
     */
    @Override
    public int deleteTeacherRecordById(Long teacherRecordId) {
        return teacherRecordMapper.deleteTeacherRecordById(teacherRecordId);
    }
}
